import userAxios from './request';

//封装：获取用户列表的函数
export let getUserList = (page=1,limit=5) =>userAxios({
  url:`/admin/user/${page}/${limit}`,
})

//获取登录用户信息
export let reqUserInfo = ()=>userAxios({
    url:"/admin/info"
  })


//获取登录请求接口
export let reqLogin = (username,pwd)=>userAxios({
  url:"/admin/login",
  method:"POST",
  data:{
    username,
    pwd
  }
})

// 获取用户信息
export const reqGetUser = (id) => userAxios({
  url: `/admin/user`,
  method: 'get',
  params: {id}
})

// 添加用户 - 表单之后回顾
export const reqAddUser = (formData) => userAxios({
  url: `/admin/user`,
  method: 'post',
  data: formData
})

// 更新用户 - 表单之后回顾
export const reqUpdateUser = (formData) => userAxios({
  url: `/admin/user`,
  method: 'put',
  data: formData
})

// 删除用户
export const reqDeleteUser = (id) => userAxios({
  url:  `/admin/user/${id}`,
  method: 'delete',
})




